﻿using AutoMapper;
using System.Collections.Generic;
using System.Data;

namespace Excel4DB.Util
{
    public static class MapperUtils
    {
        public static List<TDestination> DT2List<TSource, TDestination>(this DataTable dataTable)
        {
            Mapper.Reset();
            Mapper.Initialize(c => c.CreateMap<IDataRecord, TDestination>());
            return Mapper.Map<List<TDestination>>(dataTable);
        }
    }
}
